import shutil

size = open("u.txt")

sizelines = size.readlines()#读取全部内容  
for sizeline in sizelines:
    file = open("r1.txt")
    filelines = file.readlines()#读取全部内容  
    for fileline in filelines:
        if sizeline.strip() ==  (fileline.split(' ')[0]).strip():
            shutil.move(fileline.split(' ')[1].strip(),sizeline.strip())
    file.close()

size.close()